imx: mx6: add display of CPU temperature grade in print_cpuinfo()
authorTim Harvey <[email protected]>
Mon, 18 May 2015 13:56:46 +0000 (06:56 -0700)
committerStefano Babic <[email protected]>
Tue, 19 May 2015 13:31:46 +0000 (15:31 +0200)
When CONFIG_IMX6_THERMAL is defined print the CPU temperature grade info
along with the current temperature.

Before:
 CPU:   Temperature 42 C

After:
 CPU:   Automotive temperature grade (-40C to 125C) at 42C
 CPU:   Industrial temperature grade (-40C to 105C) at 42C
 CPU:   Extended Commercial temperature grade (-20C to 105C) at 42C

Cc: Stefan Roese <[email protected]>
Cc: Eric Nelson <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Nikita Kiryanov <[email protected]>
Cc: Jon Nettleton <[email protected]>
Cc: Jason Liu <[email protected]>
Cc: Ye Li <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Christian Gmeiner <[email protected]>
Cc: Markus Niebel <[email protected]>
Cc: Peng Fan <[email protected]>
Tested-by: Nikolay Dimitrov <[email protected]>
Signed-off-by: Tim Harvey <[email protected]>
arch/arm/imx-common/cpu.c

index 37472eadfcd5a832271f5927b7503da37401887e..275befd2f851d10b73500665c10f6906e9de6267 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
+#include <imx_thermal.h>
 #include <ipu_pixfmt.h>
 #include <thermal.h>
 #include <sata.h>
@@ -148,7 +149,7 @@ int print_cpuinfo(void)
 
 #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
        struct udevice *thermal_dev;
-       int cpu_tmp, ret;
+       int cpu_tmp, minc, maxc, ret;
 #endif
 
        cpurev = get_cpu_rev();
@@ -174,16 +175,32 @@ int print_cpuinfo(void)
 #endif
 
 #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+       puts("CPU:   ");
+       switch (get_cpu_temp_grade(&minc, &maxc)) {
+       case TEMP_AUTOMOTIVE:
+               puts("Automotive temperature grade ");
+               break;
+       case TEMP_INDUSTRIAL:
+               puts("Industrial temperature grade ");
+               break;
+       case TEMP_EXTCOMMERCIAL:
+               puts("Extended Commercial temperature grade ");
+               break;
+       default:
+               puts("Commercial temperature grade ");
+               break;
+       }
+       printf("(%dC to %dC)", minc, maxc);
        ret = uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev);
        if (!ret) {
                ret = thermal_get_temp(thermal_dev, &cpu_tmp);
 
                if (!ret)
-                       printf("CPU:   Temperature %d C\n", cpu_tmp);
+                       printf(" at %dC\n", cpu_tmp);
                else
-                       printf("CPU:   Temperature: invalid sensor data\n");
+                       puts(" - invalid sensor data\n");
        } else {
-               printf("CPU:   Temperature: Can't find sensor device\n");
+               puts(" - invalid sensor device\n");
        }
 #endif